package es.avante;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;

import libreria.Libro;

public class Ejemplo1 {

	private EntityManagerFactory emf;

    public EntityManagerFactory getEmf() {
        return emf;
    }

    public void setEmf(EntityManagerFactory emf) {
        this.emf = emf;
    }
    
    
    public List<Libro> dameLibros(){
    	EntityManager em = emf.createEntityManager();
		List<Libro> resultList = em.createQuery("from Libro").getResultList();
		em.close();
		return resultList;

    }
}
